home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / DEMON / UTILS / BUD.ARC / c / main < prev   
Text File  |  1996-06-12  |  3KB  |  102 lines

  1. /************************************************************
  2.  * BUD                                                      *
  3.  *                                                          *
  4.  * Quick UU Decoder                                         *
  5.  *                                                          *
  6.  * Emphasis on re-organising articles by file and part.     *
  7.  *                                                          *
  8.  ************************************************************
  9.  *                                                          *
  10.  * File: main.c                                             *
  11.  * Author: Kevin F. Quinn (C) February 1995                 *
  12.  *                                                          *
  13.  * Revision History                                         *
  14.  *                                                          *
  15.  * Owner | Date     | Issue | Comments                      *
  16.  * ------+----------+-------+------------------------------ *
  17.  * KFQ   | 08/02/95 | 0.01  | Initial issue                 *
  18.  * KFQ   | 12/06/95 | 0.10  | First release                 *
  19.  *                                                          *
  20.  ************************************************************/
  21.  
  22. #define _main
  23.  
  24. #include <stdio.h>
  25. #include "bud.h"
  26.  
  27. /* Main program
  28.  * ==> Help on keyword bud
  29.  * *Bud decodes one or more files containing uuencoded data, taking
  30.  *     account of multiple-part headers in network news style.
  31.  * Syntax: BUD [<options>] <file spec> [<file spec> [<file spec>...]]
  32.  * Options:
  33.  *   -v    Verbose messages on
  34.  *   -d    Debugging on
  35.  *   -w    Write new ordered file (don't uudecode)
  36.  *
  37.  * Decodes to &.oupt.bud<n>.*
  38.  * Filenames "." changed to "/"; files already existing are not
  39.  * overwritten and duplicate filenames are resolved by overwriting initial
  40.  * characters to hack out ambiguity.  Writes mapping from original
  41.  * filename to hacked filename to &.outputref.
  42.  */
  43.  
  44. static void syntax(char c)
  45. {
  46.   fprintf(stderr, "Bad option %c.\n", c);
  47.   fprintf(stderr, "Syntax: BUD [-d] [-v] [-w file] file [file [file...]]\n");
  48. }
  49.  
  50. int main(int argc, char **argv)
  51. {
  52.   bud_debug=BUD_FALSE;
  53.   bud_verbose=BUD_FALSE;
  54.   bud_write=BUD_FALSE;
  55.   bud_write_file=NULL;
  56.   bud_decode=BUD_TRUE;
  57.   argv++; argc--;
  58.   while (argc>0) {
  59.     switch ((*argv)[0])
  60.     {
  61.     case '-':
  62.       switch ((*argv)[1]) {
  63.       case 'd':
  64.       case 'D':
  65.         bud_debug=BUD_TRUE;
  66.         (void) fprintf(stderr, "Debugging on\n");
  67.         break;
  68.       case 'w':
  69.       case 'W':
  70.         if (argc>0)
  71.         {
  72.           bud_write=BUD_TRUE;
  73.           (void) fprintf(stderr, "Will generate ordered version on\n");
  74.           bud_decode=BUD_FALSE;
  75.           bud_write_file=*(++argv);
  76.           --argc;
  77.         }
  78.         else
  79.         {
  80.           syntax((*argv)[1]);
  81.           return(-1);
  82.         }
  83.         break;
  84.       case 'v':
  85.       case 'V':
  86.         bud_verbose=BUD_TRUE;
  87.         (void) fprintf(stderr, "Verbose reporting on\n");
  88.         break;
  89.       default:
  90.         syntax((*argv)[1]);
  91.         return(-1);
  92.       }
  93.       argv++; argc--;
  94.       break;
  95.     default:
  96.       bud(argc, argv);
  97.       argc=0;
  98.     }
  99.   }
  100.   return(0);
  101. }
  102.